package com.zide.operate.controller;

import java.util.List;

import com.zide.common.core.vo.CommonParamIdVO;
import com.zide.operate.domain.vo.result.OperateSupportResultVO;
import com.zide.operate.domain.vo.save.OperateSupportSaveVO;
import com.zide.operate.domain.vo.search.OperateSupportSearchVO;
import com.zide.operate.service.IOperateSupportService;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zide.common.core.domain.PageResult;
import com.zide.common.core.domain.CommonResult;
import static com.zide.common.core.domain.CommonResult.getResult;
import static com.zide.common.core.domain.CommonResult.success;

/**
 * 打赏支持Controller
 * 
 * @author zide
 * @date 2024-05-07
 */
@Tag(name = "打赏支持")
@RestController
@RequestMapping("/operate/support")
public class OperateSupportController {
    @Resource
    private IOperateSupportService operateSupportService;


    @Operation(summary = "查询打赏支持列表")
    @GetMapping("/list")
    public CommonResult list(OperateSupportSearchVO searchVO) {
        PageResult<OperateSupportResultVO> list = operateSupportService.searchOperateSupportPageList(searchVO);
        return success(list);
    }


    @Operation(summary = "获取打赏支持详细信息")
    @GetMapping(value = "/{id}")
    public CommonResult getInfo(@PathVariable("id") Long id) {
        return success(operateSupportService.selectOperateSupportById(id));
    }

    @Operation(summary = "新增打赏支持")
    @PostMapping
    public CommonResult add(@RequestBody OperateSupportSaveVO saveVO) {
        return getResult(operateSupportService.saveOperateSupport(saveVO));
    }

    @Operation(summary = "修改打赏支持")
    @PutMapping
    public CommonResult edit(@RequestBody OperateSupportSaveVO saveVO){
        return getResult(operateSupportService.updateOperateSupport(saveVO));
    }

    @Operation(summary = "删除打赏支持")
	@DeleteMapping
    public CommonResult remove(@RequestBody CommonParamIdVO idVO){
        return getResult(operateSupportService.removeOperateSupportByIds(idVO));
    }
}
